<template>
  <div>
    <template v-if="activeDetails.length>0">
      <div class="active-list" v-for="item in activeDetails" :key="item.detailId" @click="Jump(item.item_id)">
        <div class="goods-img">
          <img :src="item.is_compress === 1 ? item.pic_url+ '180x180':item.pic_url">
        </div>
        <div class="goods-info">
          <div class="title">{{item.title}}</div>
          <div class="goods-price-box">
            <div class="rewards-money"><span class="money-num" v-html="scaleGoodsPriceFn(item.price)"></span></div>
            <div class="describe-content">
              <!-- {{describe && describe.length > 12 ? describe.substring(0,12)+'...' : describe}} -->
              <div class="describe">{{describe}}</div>
              <div class="participate" :class="describe ? '': 'radius'">立即参与</div>
            </div>
          </div>
        </div>
      </div>
    </template>
    <noData v-else-if="finished && activeDetails.length==0" :noData="noData"></noData>
  </div>
</template>
<script>
import Vue from 'vue'
import { Tab, Tabs } from 'vant'
Vue.use(Tab)
Vue.use(Tabs)
import { scaleGoodsPrice } from '@/utils/index.js'
import noData from '@/components/noData/index'
export default {
  components: {
    noData,
  },
  props: {
    activeDetails: {
      type: Array,
      default() {
        return []
      }
    },
    describe: {
      type: String,
      default: ''
    },
    finished: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      noData: {
        img: 'https://img.wifenxiao.com/h5-wfx/images/no_goods.png',
        text: '暂无活动商品'
      }
    }
  },
  methods: {
    scaleGoodsPriceFn(price) {
      return scaleGoodsPrice(price)
    },
    Jump(id) {
      this.$JumpName(this, 'item-detail', { detailId: id })
    }
  }
}
</script>
<style lang="scss">
  .rewards-money{
    .money-num {
      .price-scale {
        font-size: 28px;
        .num-font{
          font-size: 40px;
        }
      }
    }
  }
@import "src/styles/mixin";
.van-tabs__nav {
  background-color: transparent
}
.van-tab {
  font-size: 28px;
}
.van-tab--active {
  color: #F20B22;
}
.van-tabs__line {
  // width: 56px!important;
  // background-color: #F20B22;
}
.van-tabs__wrap {
  height: 80px!important
}
.van-tabs__nav {
  // padding-bottom: 0;
}
.active-list {
  background-color: #fff;
  border-radius: 12px;
  margin-top: 16px;
  padding: 16px;
  display: flex;
  .goods-img {
    width: 216px;
    height: 216px;
    border-radius: 12px;
    overflow: hidden;
    margin-right: 16px;
    flex: none;
    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
  .goods-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    .goods-price-box {
      .describe-content {
        position: relative;
        margin-top: 10px;
        color: #FF2121;
        font-size: 20px;
        border-radius: 8px;
        overflow: hidden;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        .describe {
          padding: 0 24px;
          overflow: hidden;
          text-overflow: ellipsis;
          display:-webkit-box;
          -webkit-box-orient:vertical;
          -webkit-line-clamp:1;
          line-height: 64px;
          background: linear-gradient(90deg, #FDE580 0%, #FFF6D9 51%, #FEEEBB 100%);
          flex: 1;
        }
        .participate {
          // position: absolute;
          // top: 0;
          // right: 0;
          padding: 0 24px;
          width: 128px;
          line-height: 64px;
          text-align: center;
          color: #fff;
          background: linear-gradient(90deg, #FF8F5F 0%, #FF2121 100%);
          // border-top-right-radius: 8px;
          // border-bottom-right-radius: 8px;
          &.radius {
            border-radius: 8px;
          }
        }
      }

      
    }
  }
  .title {
    @include lineClamp(28px,38px,2)
  }
  
}
</style>